<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    *{
        margin: 0px;
        padding: 0px;
        list-style: none;
    }
    </style>
</head>
<body>
            <button id="ks">开始</button>
            <button id="js">结束</button>
            <h1 id="txt">开始抽奖</h1>
    <script>
    var tag1=document.getElementById('txt');
    var tag=document.getElementById('ks');
    var tag2=document.getElementById('js');
    var timer;
    var list=['哈哈哈','张三','李四','嘻嘻嘻','试试水']
    console.log(list[0]);
    console.log(list.length);
    tag.onclick=function()
    {
        clearInterval(timer);
        timer=setInterval(function(){
        var n=parseInt(Math.random()*list.length);
        tag1.innerHTML=list[n]
        },100)
    }  
    tag2.onclick=function(){
        clearInterval(timer);
    }  
    </script>
</body>
</html>